<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//FI" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="fi" xml:lang="fi">
 <head>
  <title>LIND Is Not a Dictionary</title>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
  <script src='includes/ajaxFunctions.js'></script>
  <script src='includes/otherFunctions.js'></script>
  <style type="text/css">
   <!--
   body {
    margin: 0px 0px 0px 0px;
    font-family: Sans-Serif;
    background: #bcbcbc url('images/bodyBackground.png') repeat-x left 127px;
   }

   h1 {
    margin-bottom: 10px;
    color: #6f5333;
    font-size: 14px;
    font-family: Sans-Serif;
   }

   a {
    margin: 3px 3px 3px 3px;
    color: #8a6132;
    text-decoration: none;
    font-weight: bold;
    font-size: 13px;
   }

   p {
    margin: 5px 5px 5px 5px;
    color: black;
    font-size: 13px;
    font-family: Sans-Serif;
   }

   input {
    background-color: #bcbcbc;
    border: #3f3f3f 1px solid ;
    font-size: 10px;
    margin: 0px;
    height: 15px;
   }

   .likeLink {
    margin: 3px 3px 3px 3px;
    color: #8a6132;
    text-decoration: none;
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
   }

   input[type="submit"], input[type="button"] {
    font-size: 10px;
    height: 19px;
    vertical-align: -2px;
   }

   #bodybox table p {
    margin: 0px 0px 0px 0px;
    color: black;
    font-size: 13px;
    font-family: Sans-Serif;
   }

   #headerbox {
    margin: 0px 0px 0px 0px;
    padding: 0px 0px 0px 0px;
    height: 103px;
    background: #8a6132 url('images/headerBackground.png') repeat left;
    width: 100%;
    border-bottom: #3f3f3f 1px solid;
   }

   #headerbox input {
    background-color: #d3c07e;
    color: #3f3f3f;
   }

   #headerbox form {
    position: absolute;
    top: 10px;
    right: 10px;
   }

   #headerbox img {
    margin: 3px 0px 0px 20px;
    padding: 0px 0px 0px 0px;
   }

   #infoBox {
    padding: 10px 10px 10px 10px;
    position: absolute;
    top: 0px;
    left: 120px;
    overflow: hidden;
    width: 300px;
    height: 70px;
    background-color: #d3c594;
    border-right: #3f3f3f 1px solid;
    border-left: #3f3f3f 1px solid;
    border-bottom: #3f3f3f 1px solid;
   }

   #infoBox h1 {
    margin: -7px 0 0 0;
    font-weight: bold;
   }

   .logging a {
    color: #bcbcbc;
    text-decoration: none;
    font-weight: bold;
    font-size: 13px;
   }

   .logging {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #bcbcbc;
   }

   #menubox {
    width: 100%;
    margin: 0px 0px 0px 0px;
    padding: 0px 0px 0px 0px;
    height: 22px;
    background: #6f5333 url('images/menuBackground.png') repeat-x 0px 0px;
    border-bottom: #3f3f3f 1px solid;
   }

   #menubox a {
    margin: 3px 7px 3px 7px;
    color: #bcbcbc;
    text-decoration: none;
    font-weight: bold;
    font-size: 15px;
   }

   #menubox .likeLink {
    margin: 0 5px 0 5px;
    vertical-align: 50%;
    color: #bcbcbc;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
   }

   #bodybox {
    padding: 10px 10px 10px 10px;
    margin: 6px 3px 6px 6px;
    height: 100%;
    border: #3f3f3f 1px solid;
    background-color: #d3c594;
   }

   #bodybox table {
    border: none;
    width: auto;
    margin: 0px 0px 0px 0px;
    padding: 0px 0px 0px 0px;
   }

   .shortInput {
    width: 80px;
   }

   .longInput {
    width:339px;
   }

   #table {
    border: none;
    width: 100%;
    margin: 0px 0px 0px 0px;
    padding: 0px 0px 0px 0px;
   }

   #bodycell {
    width: 70%;
    border: none;
    vertical-align: top;
    margin: 0px 0px 0px 0px;
    padding: 0px 0px 0px 0px;
   }

   #sidecell {
    width: 30%;
    border: none;
    vertical-align: top;
    margin: 0px 0px 0px 0px;
    padding: 0px 0px 0px 0px;
   }

   #sidebox {
    padding: 10px 10px 10px 10px;
    margin: 6px 6px 6px 3px;
    border: #3f3f3f 1px solid;
    background-color: #d3c594;
   }

   #sidebox img {
    margin: 5px 5px 5px 5px;
    padding: 0px 0px 0px 0px;
    border: 1px solid #3f3f3f;
   }

   #adBox {
    position: absolute;
    right: 5px;
    top: 80px;
   }
   
   #adBox img {
    border: none;
   }
   -->
  </style>
 </head>
 <body>
  <div id='headerbox'>
   <img src='images/header.png' />
   <div id='infoBox'><p>Welcome to LIND!</p></div>
   <?php

//Logginginfo-box
if (!isset($_COOKIE['username'])) {
 echo "
 <form action='logging.php?f=in' method='post'>
  <input type='text' name='username' maxlength='30' size='10' />
  <input type='password' name='password' maxlength='30' size='10' />
  <input type='submit' value='Log in'>
 </form>";
}

else {
 //Strips " and ' marks
 $bannedMarks = array("\"", "'");
 $_COOKIE['username'] = str_replace($bannedMarks, "", $_COOKIE['username']);

 echo "<p class='logging'>Log out username: <a href='logging.php?f=out'>{$_COOKIE['username']}</a></p>";
}
   ?>
  </div>
  <div id='menubox'>
   <span class='likeLink' onClick='showIndex()'>Index</span>
   <span class='likeLink' onClick='showSwichDictionaries()'>Swich dictionaries</span>
   <span class='likeLink' onClick='showQuery()'>Query</span>
   <span class='likeLink' onClick='showUsers()'>Users</span>
   <span class='likeLink' onClick='showAddWordsMenu()'>Add words</span>
   <span class='likeLink' onClick='showAddUser()'>Add user</span>
   <?php
//Admin partition if user's admin
include('includes/connection_settings.php');

$table = mysql_query("SELECT username FROM users WHERE admin = true");
for ($i = 0; $i < mysql_num_rows($table); $i++) {
 if ($_COOKIE['username'] == mysql_result($table, $i, 0)) {
  echo "
   <span class='likeLink' onClick='showAdmin()'>Admin</span>";
 }
}
   ?>
  </div>
  <table id='table' cellspacing='0'>
   <tr><td id='bodycell'><div id='bodybox'>
